package com.gome.base;

import com.gome.vue4j.core.AbstractVue4jComponent;
import com.gome.vue4j.core.FXMLPath;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.fxml.FXML;

/**
 * 监听数据编号
 */
@FXMLPath("/base/l6-view.fxml")
public class L6ListenerComponent extends AbstractVue4jComponent {

    @FXML
    StringProperty counter = new SimpleStringProperty("0"){
        {
            addListener((observableValue, number, newNumber) -> {
                System.out.println("数字发生变化:" + newNumber);
            });
        }
    };

    @FXML
    void add(){
        int  n =Integer.parseInt(counter.get()) + 1;
        counter.set("" + n);
    }

}
